package cn.ehcache;

import org.ehcache.Cache;
import org.ehcache.CacheManager;
import org.ehcache.config.Configuration;

import java.time.Duration;

/**
 * 类简介:  缓存管理类
 *
 * @Author: ShangGuan
 * @Time: 2024/05/13
 **/
public interface CacheManagerProvider<K, V>  extends CacheManager {


    org.ehcache.Cache<K, V> createCache(Duration timeToLive);

    /**
     * 创建缓存
     *
     * @param timeToLive 生存时间 {@see Duration.ofMinutes(2)}
     * @param capacity   容量
     * @return {@link Cache}<{@link K}, {@link V}>
     */
    org.ehcache.Cache<K, V> createCache(Duration timeToLive, Integer capacity);

    /**
     * 获取缓存
     *
     * @return {@link org.ehcache.Cache}<{@link K}, {@link V}>
     */

    org.ehcache.Cache<K, V> getCache();

    /**
     * 删除缓存
     *
     * @param cacheName 缓存名称
     */

    void removeCache(String cacheName);


    /**
     * 获取运行时配置
     *
     * @return {@link Configuration}
     */

    Configuration getRuntimeConfiguration();

}
